<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>监理服务系统</title>
    <!--layui样式-->
    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/layui/css/layui.css"/>
    <!---->
    <!--公用样式-->
    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/common/css/comment.css"/>
    <!--公用样式-->
    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/common/css/style.css"/>
    <!--扩展样式-->
    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/common/css/extended.css"/>
    <!--auto-complete 自动选择文本css-->
    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/layui/css/autocomplete.css"/>
    <!--Jquery-->
    <script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
    <!--Jquery-->
    <script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
    <style>
        .option {
            border: none;
        }
    </style>
</head>
<body>
<!--容器-->
<div class="container clearfix">
    <form class="layui-form" id="myForm" style="margin-left: 20px;">
        <div class="fr mt50">
            <!--创建项目-->
            <div class="creatProject whitebg">
                <div class="bold ft18">修改项目</div>
                <ul class="clearfix mt20">
                    <li class="clearfix">
                        <label class="fl">项目来源<span style="color: red">*</span></label>
                        <select class="fl" id="projectSource" name="projectSource" lay-verify="notnull" disabled="disabled" lay-ignore>
                            <option value="">请选择</option>
                            <#list projectSourcelist as vo>
                                <option value="${vo.badtCode}"
                                        <#if (prj.projectSource)??>
                                            <#if (prj.projectSource) ==(vo.badtCode)>
                                                selected=selected
                                            </#if>
                                        </#if>
                                >${vo.badtName}
                                </option>
                            </#list>
                        </select>
                    </li>
                    <li class="clearfix">

                        <#--   <label class="fl">选择项目(可选)</label>
                           <select class="fl" id="project" name="project" lay-ignore disabled>
                               <option value="">请选择</option>
                           </select>-->
                    </li>
                </ul>
            </div>
            <!--项目类型-->
            <div class="creatProject projectCate whitebg" style="margin-top: 20px;">
                <div class="bold ft18">项目类型</div>
                <ul class="clearfix mt20">
                    <li class="clearfix">
                        <label class="fl">项目类型<span style="color: red">*</span></label>
                        <select class="fl" id="projectType" name="projectType" lay-verify="notnull" lay-ignore>
                            <option value="">请选择</option>
                            <#list projectTypeList as pjtvo>
                                <option value="${pjtvo.badtCode}"
                                        <#if (prj.projectType)??>
                                            <#if (prj.projectType) ==(pjtvo.badtCode) >
                                                selected=selected
                                            </#if>
                                        </#if>
                                >${pjtvo.badtName}</option>
                            </#list>
                        </select>
                    </li>
                    <li class="clearfix">
                        <label class="fl">业务类型<span style="color: red">*</span></label>
                        <select class="fl" id="checkShape" name="checkShape" lay-verify="required" lay-ignore >
                            <option value="">请选择</option>
                            <#list checkShapeList as csl>
                                <option value="${csl.badtCode}"
                                        <#if (prj.checkShape)??>
                                            <#if (prj.checkShape) ==(csl.badtCode) >
                                                selected=selected
                                            </#if>
                                        </#if>
                                >${csl.badtName}</option>
                            </#list>
                        </select>
                    </li>
                    <li class="clearfix">
                        <label class="fl">是否续签<span style="color: red">*</span></label>
                        <select class="fl" id="isContinue" name="isContinue" lay-verify="notnull" lay-ignore>
                            <option value="">请选择</option>
                            <#list isContinueList as icl>
                                <option value="${icl.badtCode}"
                                        <#if (prj.isContinue)??>
                                            <#if (prj.isContinue) ==(icl.badtCode) >
                                                selected=selected
                                            </#if>
                                        </#if>
                                >${icl.badtName}</option>
                            </#list>
                        </select>
                    </li>
                </ul>
            </div>
            <!--项目信息-->
            <div class="creatProject projectData whitebg">
                <div class="bold ft18">项目信息</div>
                <ul class="clearfix mt20">
                    <li class="clearfix"  style="width: 31%;">
                        <label class="fl">项目名称<span style="color: red">*</span></label>
                        <input type="text" class="fl" id="projectName" name="projectName" value="${prj.projectName}"
                               lay-maxlength="80" lay-verify="required|maxlength"
                                <#if ("${prj.supProjectId}"!=""  && "${prj.supProjectId}"!=null) >
                                    readonly="readonly"
                                </#if>
                        >
                        <input  type="hidden"  value="${prj.supProjectId}"/>
                        <input type="hidden" id="id" name="id" value="${prj.id}">
                    </li>
                    <li class="clearfix">
                        <label class="fl">总工期<span style="color: red">*</span></label>
                        <input class="fl" name="totalDate" id="totalDate"value="${prj.totalDate}" op="1" AutoComplete="off"onchange="_crt_page.events.toDate2(this)"
                               style="width:90px;margin-left: 15px" >
                        <span class="fl" style="margin-left: 5px;">日</span>
                        <span style="color: red" class="fl">*</span>
                        <input name="totalDurationBeginDate" value="${prj.totalDurationBeginDate}"class="fl test-item gq" op="0" zgq="start" type="datetime"  readonly="true"
                               id="totalDurationBeginDate"
                               AutoComplete="off" placeholder="请选择开始日期" lay-verify="required"
                               style="margin-left: 10px;width:123px"/>
                        <span style="color: red" class="fl">*</span>
                        <input class="fl" name="totalDurationEndDate" value="${prj.totalDurationEndDate}" placeholder="结束日期" id="totalDurationEndDate" AutoComplete="off" readonly="true"
                               style="width:150px;margin-left: 15px" >

                    </li>
                    <li class="clearfix">
                        <label class="fl">投资额<span style="color: red">*</span></label>
                        <input type="text" class="fl" id="tzMoney" name="tzMoney" value="${prj.tzMoney}"
                               lay-maxlength="20" lay-verify="required|decimal|maxlength"
<#--                                <#if ("${prj.supProjectId}"!=""  && "${prj.supProjectId}"!=null) >-->
<#--                                    readonly="readonly"-->
<#--                                </#if>-->
                        >
                        <span class="fl">元</span>
                    </li>
                    <li class="clearfix">
                        <label class="fl">合同编号</label>
                        <input id="contractNo" name="contractNo" value="${prj.contractNo}" class="fl" type="text"
                               lay-maxlength="128"  lay-verify="maxlength"
<#--                                <#if "${htbh}"=="0">-->
<#--                                    readonly="readonly"-->
<#--                                </#if>-->
                        />
                    </li>
                    <li class="clearfix">
                        <label class="fl">内部合同编号</label>
                        <input id="insideContractNo" name="insideContractNo" value="${prj.insideContractNo}" class="fl" type="text"
                               <#if (createrzz) != '1'>disabled</#if> lay-maxlength="128"  lay-verify="maxlength"/>
                    </li>
                    <li class="clearfix">
                        <label class="fl" style="width:120px">采购/项目编号</label>
                        <input id="payOrProjectNo" name="payOrProjectNo" value="${prj.payOrProjectNo}" class="fl"
                               type="text" lay-maxlength="128"  lay-verify="maxlength"
<#--                                <#if "${cgbh}"=="0">-->
<#--                                    readonly="readonly"-->
<#--                                </#if>-->
                        />
                    </li>
                    <li class="clearfix">
                        <label class="fl">咨询合同名称</label>
                        <input id="jlHtName" name="jlHtName"  style="width: 60%;" class="fl" value="${prj.jlHtName}" type="text" lay-maxlength="128"  lay-verify="maxlength"/>
                    </li>
                    <#--<li>
                        <div class="projectMain clearfix" id="FB">
                            <div class="clearfix" id="div-addFB">
                                &lt;#&ndash;onchange="onchangeFb()" 填完之后就能出现input框&ndash;&gt;
                                <label class="fl w90">项目分包数</label>
                                <input type="text" class="fl w90" id="fbNum" name="fbNum"  onblur="_crt_page.packages.fbnumblur(this)" value="${prj.fbNum}">
                                <img src="${re.contextPath}/plugin/common/images/26@2x.png" id="addpackage" alt=""
                                     class="fl cursor">
                            </div>
                            <#list pklist?sort_by("code") as vo>
                                <div class="clearfix">
                                    <label class="fl w90">分包编号${(vo_index+1)}</label>
                                    <input type="hidden" value="${vo.id}" name="projectContracts[${vo_index}].id">
                                    <input type="text" value="${vo.code}" class="fl sss"
                                           name="projectContracts[${vo_index}].code">
                                    <img src="/plugin/common/images/31@2x.png" onclick="_crt_page.packages.del(this)"
                                         idx="${vo_index}" alt="" class="fl cursor">
                                </div>
                            </#list>
                        </div>
                    </li>-->
                    <li class="clearfix"  style="width: 31%;">
                        <label class="fl">项目归属<span style="color: red">*</span></label>
                        <select class="fl" id="projectOwner" name="projectOwner" lay-verify="required" lay-ignore>
                            <option value="">请选择</option>
                            <#list comlistOwner as vo>
                                <option value="${vo.bcId}"
                                        <#if (prj.projectOwner)??>
                                            <#if (prj.projectOwner) ==(vo.bcId) >
                                                selected=selected
                                            </#if>
                                        </#if>
                                >${vo.bcName}</option>
                            </#list>
                        </select>
                    </li>

                    <li class="clearfix">
                        <label class="fl">行业类型</label>
                        <select class="fl" id="hyType" name="hyType" lay-ignore>
                            <option value="">请选择</option>
                            <#list hytypelist as vo>
                                <option value="${vo.badtCode}"
                                        <#if (prj.hyType)??>
                                            <#if (prj.hyType) ==(vo.badtCode) >
                                                selected=selected
                                            </#if>
                                        </#if>
                                >${vo.badtName}</option>
                            </#list>
                        </select>
                    </li>
                    <#--<li class="clearfix" style="width: 50%;">
                        <label class="fl" style="width: 17%;">项目分布地</label>
                        <div class="address fl clearfix ssplace" style="width: 80%">
                            <#list  listpalce  as place >
                                <div class="clearfix mt10 divplaceselect">
                                    <select name="projectPlacedtos[${place_index}].province" class="ml8 fl" id="placeprovince0" onchange="_crt_page.events.provinceChange(this)" style="width:90px !important;"
                                            lay-verify="required"
                                            <#if ("${prj.supProjectId}"!=""  && "${prj.supProjectId}"!=null) >
                                                disabled="disabled"
                                            </#if>
                                            lay-ignore>
                                        <option value="">请选择</option>
                                        <#list provincelist as vo>
                                            <option value="${vo.code}"
                                                    <#if "${place.province}"=="${vo.code}">
                                                        selected
                                                    </#if>
                                            >${vo.name}</option>
                                        </#list>
                                    </select>
                                    <select name="projectPlacedtos[${place_index}].city" id="placecity0" class="ml8 fl" lay-filter="city" onchange="_crt_page.events.cityChange(this)" lay-verify="required"
                                            style="width: 90px !important;margin-left: 10px"
                                            <#if ("${prj.supProjectId}"!=""  && "${prj.supProjectId}"!=null) >
                                                disabled="disabled"
                                            </#if>
                                            lay-ignore>
                                        <option value="">请选择</option>
                                        <#list place.citys as vocity>
                                            <option value="${vocity.code}"
                                                    <#if "${place.city}"=="${vocity.code}">
                                                        selected
                                                    </#if>
                                            >${vocity.name}</option>
                                        </#list>
                                    </select>
                                    <select name="projectPlacedtos[${place_index}].county" id="placecounty0" class="ml8 fl" lay-filter="county" lay-verify="required"
                                            style="width:90px !important;margin-left: 10px" lay-ignore
                                            <#if ("${prj.supProjectId}"!=""  && "${prj.supProjectId}"!=null) >
                                                disabled="disabled"
                                            </#if>
                                    >
                                        <option value="">请选择</option>
                                        <#list place.countys as vocounty>
                                            <option value="${vocounty.code}"
                                                    <#if "${place.county}"=="${vocounty.code}">
                                                        selected
                                                    </#if>
                                            >${vocounty.name}</option>
                                        </#list>
                                    </select>
                                    <#if ("${prj.supProjectId}"!=""  && "${prj.supProjectId}"!=null) >
                                    <#else >
                                        <img src="${re.contextPath}/plugin/common/images/77@2x.png" class="fl ml20 addplaceimage"  style="width: 28px" onclick="_crt_page.events.addPlace(this)" >
                                        <img src="${re.contextPath}/plugin/common/images/76@2x.png" class="fl ml20"   style="width: 28px" onclick="_crt_page.events.deletePlace(this)">

                                    </#if>

                                </div>
                            </#list>
                        </div>
                    </li>-->
                    <li class="clearfix" style="width: 50%">
                        <label class="fl">合同签订地点<span style="color: red">*</span></label>
                        <select name="province" class="ml8" id="province" style="width:90px !important;"
                                lay-verify="required" lay-ignore
<#--                                <#if ("${prj.supProjectId}"!=""  && "${prj.supProjectId}"!=null) >-->
<#--                                    disabled="disabled"-->
<#--                                </#if>-->

                        >
                            <option value="">请选择</option>
                            <#list provincelist as vo>
                                <option value="${vo.code}"
                                        <#if (prj.province)??>
                                            <#if (prj.province) ==(vo.code) >
                                                selected=selected
                                            </#if>
                                        </#if>
                                >${vo.name}</option>
                            </#list>
                        </select>
                        <select name="city" id="city" class="ml8" lay-filter="city" lay-verify="required"
                                style="width:100px !important;" lay-ignore
<#--                                <#if ("${prj.supProjectId}"!=""  && "${prj.supProjectId}"!=null) >-->
<#--                                    disabled="disabled"-->
<#--                                </#if>-->
                        >
                            <option value="">请选择</option>
                            <#list citylist as vo>
                                <option value="${vo.code}"
                                        <#if (prj.city)??>
                                            <#if (prj.city) ==(vo.code) >
                                                selected=selected
                                            </#if>
                                        </#if>
                                >${vo.name}</option>
                            </#list>
                        </select>
                        <select name="county" id="county" class="ml8" lay-filter="county" lay-verify="required"
                                style="width:110px !important;" lay-ignore
<#--                                <#if ("${prj.supProjectId}"!=""  && "${prj.supProjectId}"!=null) >-->
<#--                                    disabled="disabled"-->
<#--                                </#if>-->
                        >
                            <option value="">请选择</option>
                            <#list countylist as vo>
                                <option value="${vo.code}"
                                        <#if (prj.county)??>
                                            <#if (prj.county) ==(vo.code) >
                                                selected=selected
                                            </#if>
                                        </#if>
                                >${vo.name}</option>
                            </#list>
                        </select>
                    </li>
                    <#if (createrzz) == '1'>
                        <div class="layui-row" >
                            <li class="clearfix w25p">
                                <label class="fl w40p">是否需要招投标</label>
                                <select class="fl w40p" id="biddingRequired"
                                        onchange="_crt_page.events.toZhaoBiao(this)"
                                        name="biddingRequired" lay-ignore>
                                    <option value="">请选择</option>
                                    <option value="1" <#if (prj.biddingRequired) == '1'>selected=selected</#if>>是</option>
                                    <option value="0" <#if (prj.biddingRequired) == '0'>selected=selected</#if>>否</option>
                                </select>
                            </li>
                            <li class="clearfix w25p" id = 'zhaobiaoDiv'
                                <#if "${prj.biddingRequired}" == '0'>
                                    style="display: none"
                                </#if>
                            >
                                <label class="fl w25p">是否已招标</label>
                                <select class="fl w40p" id="hasInviteBids" name="hasInviteBids" lay-ignore>
                                    <option value="">请选择</option>
                                    <option value="1" <#if (prj.hasInviteBids) == '1'>selected=selected</#if>>是</option>
                                    <option value="0" <#if (prj.hasInviteBids) == '0'>selected=selected</#if>>否</option>
                                </select>
                            </li>
                            <li class="clearfix w25p">
                                <label class="fl w30p">是否已签合同</label>
                                <select class="fl w40p" id="hasContractSigned"
                                        onchange="_crt_page.events.toHetong(this)"
                                        name="hasContractSigned" lay-ignore>
                                    <option value="">请选择</option>
                                    <option value="1" <#if (prj.hasContractSigned) == '1'>selected=selected</#if>>是</option>
                                    <option value="0" <#if (prj.hasContractSigned) == '0'>selected=selected</#if>>否</option>
                                </select>
                            </li>
                            <li class="clearfix w25p">
                                <label class="fl w30p">是否有首付款</label>
                                <select class="fl w40p" id="hasDownPayment" name="hasDownPayment" lay-ignore>
                                    <option value="">请选择</option>
                                    <option value="1" <#if (prj.hasDownPayment) == '1'>selected=selected</#if>>是</option>
                                    <option value="0" <#if (prj.hasDownPayment) == '0'>selected=selected</#if>>否</option>
                                </select>
                            </li>
                        </div>
                        <div class="layui-row" id ="hetongDiv"
                                <#if "${prj.hasContractSigned}" == '0'>
                            style="display: none"
                                </#if>>
                            <li class="clearfix">
                                <label class="fl w30p">合同签订时间</label>
                                <input name="contractSignTime" class="fl w40p pl10" type="datetime"  id="contractSignTime" value="${prj.contractSignTime}"
                                       AutoComplete="off" placeholder="请选择合同签订时间"/>
                            </li>
                        </div>


                    </#if>
                </ul>
            </div>
            <!--业主单位-->
            <div id="FZR" class="enterpriseUnit whitebg">
                <div class="clearfix">
                    <label class="fl">业主单位<span style="color: red">*</span></label>
                    <input type="text" class="fl" value="${prj.owerCompany}" id="owerCompany" lay-maxlength="128"  lay-verify="required|maxlength"
                           name="owerCompany"
                    >
                </div>
                <#list listyz as vo>
                    <div class="enterpriseUnitList">
                        <div class="bold ft18">项目负责人<span class="unit-ind">${(vo_index+1)}</span>
                            <#if "${xmjl}" =='1' && "${prj.status}" == "001">
                                <img src="${re.contextPath}/plugin/common/images/31@2x.png"
                                        onclick="_crt_page.fzr.del(this)" idx="${(vo_index)}" alt="" class="fr cursor"
                                        style="width:13px">
                            </#if>
                        </div>
                        <ul class="clearfix mt20">
                            <li class="clearfix">
                                <label class="fl">项目负责人<span style="color: red">*</span></label>
                                <input type="text" value="${vo.realName}" class="fl unit-ind-1"
                                       name="projectLeaders[${(vo_index)}].realName" lay-maxlength="128"  lay-verify="required|maxlength"/>
                                <input class="unit-ind-1" type="hidden" name="projectLeaders[${(vo_index)}].projectLeader"
                                       value="${vo.projectLeader}"/>
                                <input class="unit-ind-1" type="hidden" name="projectLeaders[${(vo_index)}].id" value="${vo.id}"/>
                            </li>
                            <li class="clearfix">
                                <label class="fl">职务<span style="color: red">*</span></label>
                                <input type="text" value="${vo.duty}" class="fl"
                                       name="projectLeaders[${(vo_index)}].duty" lay-maxlength="128"  lay-verify="required|maxlength">
                            </li>
                        </ul>
                    </div>
                </#list>
                <div class="center">
                    <button type="button" class="bluebg white bor0" id="btn_addfzr">添加</button>
                </div>
            </div>
            <!--监理单位-->
            <div class="supervisionUnit whitebg">
                <ul class="clearfix">
                    <li class="clearfix">
                        <label class="fl">咨询单位<span style="color: red">*</span></label>
                        <div style="display: flow-root;" class="fl wp42 h35">
                            <div class="slt" id="supervisorCompany"></div>
                        </div>
                    </li>
                    <li class="clearfix">
                        <label class="fl">项目经理<span style="color: red">*</span></label>
                        <div style="display: flow-root;" class="wp42 h3">
                            <div class="slt" id="projectManagerPerson"></div>
                        </div>
                    </li>
                    <li class="clearfix">
                        <label class="fl">咨询工程师<span style="color: red">*</span></label>
                        <div style="display: flow-root;" class="fl wp42 h35">
                            <div class="slt" id="zxAdviser"></div>
                        </div>
                    </li>
                    <li class="clearfix">
                        <label class="fl">行业负责人<span style="color: red">*</span></label>
                        <div style="display: flow-root;" class="fl wp42 h35">
                            <div class="slt" id="industryPerson"></div>
                        </div>
                    </li>
                    <li class="clearfix">
                        <label class="fl">技术负责人<span style="color: red">*</span></label>
                        <div style="display: flow-root;" class="fl wp42 h35">
                            <div class="slt" id="technologyPerson"></div>
                        </div>
                    </li>
                    <li class="clearfix">
                        <label class="fl">咨询合同额<span style="color: red">*</span></label>
                        <input type="text" class="fl" value="${prj.htMoney}" id="htMoney" name="htMoney" lay-maxlength="20"
                               lay-verify="required|decimal|maxlength" onblur="_crt_page.events.displayMilepost(this)">
                        <span class="ml10 fl">元</span>
                    </li>
                </ul>
            </div>
            <!--阶段设置 里程碑进度占比-->
            <div class="stage clearfix" id="stagebox">
                <div class="stageLf whitebg fl">
                    <div class="bold ft18">阶段设置<span style="color: red">*</span></div>
                    <ul id="zbjd">
                        <#list listStage as vo>
                            <li class="clearfix <#if vo_index==0>selected</#if>" stageid="${vo.id}">
                                <input type="checkbox" class="stagechk fl clearfix" value="${vo.id}" name=""
                                       <#if vo.status=="1">checked=""</#if> lay-skin="primary" lay-filter="stage"
                                       title="${vo.stageName}">
                                <input type="hidden" class="zbstage" name="zxProjectStages[${vo_index}].id"
                                       value="${vo.id}">
                                <input type="hidden" class="" name="zxProjectStages[${vo_index}].zbName"
                                       value="${vo.stageName}">
                                <input type="hidden" class="" name="zxProjectStages[${vo_index}].stageNo"
                                       value="${vo.stageNo}">
                                <input type="hidden" class="" name="zxProjectStages[${vo_index}].orderNum"
                                       value="${vo.orderNum}">
                                <input type="hidden" class="open" name="zxProjectStages[${vo_index}].status"
                                       value="${vo.status}">
                                <input type="hidden" class="" name="zxProjectStages[${vo_index}].createBy"
                                       value="-1">
                                <div class="fr clearfix">
                                    <input type="text" class="fl stagerq jdgq" id="zbBeginDate" lay-verify="required" autocomplete="off"
                                           name="zxProjectStages[${vo_index}].startDate" value="${vo.startDate}">
                                    <span class="fl">--</span>
                                    <input type="text" class="fl stagerq jdgq"  id="zbEndDate" lay-verify="required" autocomplete="off"
                                           name="zxProjectStages[${vo_index}].endDate" value="${vo.endDate}">
                                </div>
                            </li>
                        </#list>
                    </ul>
                </div>
                <div class="stageRt whitebg fr" id="dvmilepost">
                    <div class="bold ft18">里程碑进度占比</div>
                    <#assign idx=0>
                    <#list listStage as vo>
                        <ul pid="${vo.id}" <#if vo_index!=0>style="display: none"</#if>>
                            <#list listMilePost as vm>
                                <#if vm.supervisorProjectStageId=vo.id>
                                    <li class="clearfix">
                                        <span class="fl">
                                            <input type="checkbox" name="lcb" lay-filter="milepost" lay-skin="primary" checked=""
                                                   title="${vm.milepostName}">
                                            <input type="hidden" class="open" name="zxProjectMileposts[${idx}].status" value="1">
                                        </span>
                                        <input type="hidden" class="jdmilepostno"
                                               name="zxProjectMileposts[${idx}].milepostNo"
                                               value="${vm.milepostNo}">
                                        <input type="hidden" class="jdmilepostno"
                                               name="zxProjectMileposts[${idx}].id"
                                               value="${vm.id}">
                                        <input type="hidden" class="jdpercentage"
                                               name="zxProjectMileposts[${idx}].supervisorProjectStageId"
                                               value="${vm.supervisorProjectStageId}">
                                        <input type="hidden" class="jdpercentage"
                                               name="zxProjectMileposts[${idx}].spmBaseMilePostId"
                                               value="${vm.spmBaseMilePostId}">
                                        <div class="fr">
                                            <input type="text" class="jdpercentage"
                                                   name="zxProjectMileposts[${idx}].percentage"
                                                   value="${vm.percentage}" style="width: 80px;text-align: right" lay-maxlength="3"  lay-verify="perdecimal|maxlength"
                                            >%</div>
                                        <input type="hidden" class="" name="zxProjectMileposts[${idx}].createBy"
                                               value="-1">
                                    </li>
                                    <#assign idx=idx+1>
                                </#if>
                            </#list>
                        </ul>
                    </#list>
                </div>
            </div>
            <!--监理费付款方式-->
            <div class="payways whitebg">
                <li class="clearfix" style="width: 40%;">
                    <label class="fl">咨询费付款方式</label>
                    <select class="fl" id="fkfs" name="fkfs" lay-verify="required"  style="margin-left: 15px"
                            onchange="_crt_page.events.toDate(this)" lay-ignore>
                        <option value="1"
                                <#if (prj.fkType) =='1' >
                            selected=selected
                                </#if>>节点</option>
                        <option value="2"
                                <#if (prj.fkType) =='2' >
                            selected=selected
                                </#if>>时间</option>
                    </select>
                </li>
                <table class="layui-hide" id="payways" lay-filter="payways"></table>
            </div>
            <!--提交-->
            <div class="createBtn clearfix">
                <button type="submit" lay-submit lay-filter="save"  onclick="resetRequired()" class="bluebg white bor0 fl" id="btnsave">保存</button>
                <#if "${xmjl}" =='1' && "${prj.status}" == "001">
                    <button type="submit" lay-submit lay-filter="submit"  onclick="resetRequiredSubmit()" class="bluebg white bor0 fr" id="btnsubmit">提交
                    </button>
                </#if>
            </div>
        </div>
    </form>
</div>
<!--layui JS-->
<script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.js" charset="utf-8"></script>
<!--公用样式JS-->
<script type="text/javascript" charset="utf-8" src="${re.contextPath}/plugin/common/js/comment.js"></script>
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js"></script>
<!--启动JS-->
<script type="text/javascript" charset="utf-8" src="${re.contextPath}/plugin/common/js/jquery.boot.js"></script>
<!--启动JS-->
<script type="text/javascript" charset="utf-8" src="${re.contextPath}/plugin/common/js/jquery.common.js"></script>
<#-- 可以多选的下拉框 -->
<script src="${re.contextPath}/plugin/layui/xm-select.js"></script>

<!-- 公共配置第三方组件 -->
<script type="text/javascript">
    layui.config({
        version: false,
        debug: false,
        base: "${re.contextPath}/plugin/layui/lay/extra/"
    })
</script>
<script type="text/html" id="toolbarDemo">
    <div class="layui-btn-container">
        <a class="layui-btn layui-btn-sm" lay-event="addrow">追加付款节点</a>
    </div>
</script>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script>
    var layer, form, laydate, autocomplete, table,dropdown,biliTotal;
    var params = [{name: 1, value: "张三1sssss"}, {name: 2, value: "张三ssss2"}, {name: 3, value: "张三3sss"}, {
        name: 4,
        value: "张三4sssssssss"
    }, {name: 5, value: "张三sssss5"}];
    var _crt_page;
    var xmselectxmjl;
    var xmselectzxgw;
    var xmselecthyfzr;
    var xmselectsecondzjl;
    var xmselectjsfzr;
    var xmselectcompany;
    var fksj;
    var _gpakgs = [];
    var stamil=[];
    <#list listStage as vo>
    var sta = {
        checkd: true,
        stagename: '${vo.stageName}',
        milepostlist: []
    };
    stamil.push(sta);
    <#list listMilePost as vm>
    var milobj = {
        checkd: true,
        num: '${vm.percentage}',
        milepostname: '${vm.milepostName}'
    };
    <#if vm.supervisorProjectStageId = vo.id>
    stamil[stamil.length - 1].milepostlist.push(milobj)
    </#if>
    </#list>
    </#list>
    layui.use(['form', 'laydate', 'layer', 'autocomplete'], function () {
        laydate = layui.laydate,form = layui.form,layer = layui.layer;
        form.verify({
            maxlength: function (v,item) {
                var maxlength = item.getAttribute('lay-maxlength');
                if(v.trim()!=''){
                    if(v.trim().length>maxlength){
                        return "输入长度不能大于"+maxlength+"个字符！";
                    }
                }
            },
            number: function (v) {
                debugger;
                var reg = /^[0-9]*$/;
                var flag = reg.test(v.trim());
                if (!flag) {
                    return '请输入正确的数字';
                }
            },
            decimal: function (v) {
                var reg = /^[1-9][0-9]*([.][0-9]+)?$/;
                if(v.trim()){
                    var flag = reg.test(v.trim());
                    if (!flag) {
                        return '请输入数字';
                    }
                }

            },
            perdecimal: function (v) {
                var reg = /^[1-9][0-9]*([.][0-9]+)?$/;
                var flag = reg.test(v.trim());
                if (!flag) {
                    if(v.trim()!="0"  || v.trim()!=0){
                        return '请输入数字';
                    }
                }
            }
        })
        autocomplete = layui.autocomplete;
        _crt_page = {
            _init: function () {
                //初始化事件
                _crt_page.events._init();
                //forms初始化
                _crt_page.forms._init();
                //tables初始化
                _crt_page.tables._init();

            },
            forms: {
                _init: function () {
                    //初始化Form
                    form.on('submit(save)', _crt_page.forms.create);
                    form.on('submit(submit)', _crt_page.forms.submit);
                    form.on('checkbox(stage)', _crt_page.forms.checkbox.stageChange);
                    form.on('checkbox(milepost)', _crt_page.forms.checkbox.milepostChange);
                    //日期初始化
                    _crt_page.forms.date._init();
                    _crt_page.stages.loadStageMile._initStageDate();
                    //多选下拉初始化
                    _crt_page.forms.selects._init();
                    //初始化负责人相关
                    _crt_page.fzr._init();
                    _crt_page.stages._init();
                },
                checkbox: {
                    stageChange: function (data) {
                        if (data.elem.checked) {
                            $(data.elem).parent().find(".open").val("1");
                            $(data.elem).parent().find('.stagerq').attr('lay-verify','required');
                            var stageId = $(data.elem).parent().attr('stageid');
                            $(data.elem).parents('.stageLf').next().find('ul[pid=' + stageId + '] input[type=checkbox]').prop('checked', true);
                            $(data.elem).parents('.stageLf').next().find('ul[pid=' + stageId + '] .open').val('1');
                            form.render('checkbox');
                        } else {
                            $(data.elem).parent().find(".open").val("0");
                            //取消对应的开始时间,结束时间的校验:
                            $(data.elem).parent().find('.stagerq').removeAttr('lay-verify');
                            //把其下的所有里程取消选中:
                            var stageId = $(data.elem).parent().attr('stageid');
                            $(data.elem).parents('.stageLf').next().find('ul[pid='+stageId+'] input[type=checkbox]').prop('checked',false);
                            $(data.elem).parents('.stageLf').next().find('ul[pid='+stageId+'] .open').val('0');
                            form.render('checkbox');
                        }
                    },
                    milepostChange: function (data){
                        if (data.elem.checked) {
                            //设置状态字段
                            $(data.elem).parent().find(".open").val("1");
                            //验证,如果选中了当前的里程碑,并且当前选中的里程碑为1,那么把当前阶段的checkbox选中:
                            var checkedMilepostLength = $(data.elem).parents('ul').find('.layui-form-checked').length;
                            console.log('checkedMilepostLength')
                            console.log(checkedMilepostLength)
                            if(checkedMilepostLength == 1){
                                var stageId = $(data.elem).parents('ul').attr('pid');
                                console.log(stageId)
                                console.log('stageId')
                                var stageChecked = $("#zbjd").find('li[stageid='+stageId+'] input[type=checkbox]').next().hasClass('layui-form-checked');
                                console.log(stageChecked)
                                console.log('stageChecked')
                                if(!stageChecked){
                                    $("#zbjd").find('li[stageid='+stageId+']').find('input[type=checkbox]').click();
                                    $("#zbjd").find('li[stageid='+stageId+']').find('.open').val('1');
                                    $("#zbjd").find('li[stageid='+stageId+']').find('.stagerq').attr('lay-verify','required');
                                    form.render('checkbox');
                                }
                            }
                        } else {
                            $(data.elem).parent().find(".open").val("0");
                        }
                    }
                },
                date: {
                    _init: function () {
                        lay('.gq').each(function () {
                            var that=this;
                            laydate.render({
                                elem: this,
                                type: 'date',
                                trigger: 'click',
                                done: function (value, date) {
                                    var date = $("#totalDurationBeginDate").val();
                                    var code = $("#totalDate").val();
                                    console.log(date)
                                    if(code == null || code == "" || code == undefined){
                                        return;
                                    }
                                    var re = /^[0-9]*[1-9][0-9]*$/ ;
                                    if(!(re.test(code))){
                                        layer.msg("请输入正整数", {icon: 2});
                                        $(object).val("");
                                        return;
                                    }
                                    var day = DateDiff2(date,code);
                                    $("#totalDurationEndDate").val(day);
                                    $("#zbjd").find("li").last().find("#zbEndDate").val(day)
                                    $("#zbjd").find("li").first().find("#zbBeginDate").val(date)
                                }
                            });
                        });
                        laydate.render({
                            elem: '#contractSignTime',
                            trigger: 'click'
                        })
                    }
                },
                totals: function () {
                    var stafecheckbox = $('#zbjd').find('li');
                    var milcheckbox = $('#dvmilepost').find('ul');
                    stafecheckbox.each(function (index, item) {
                        if ($(this).find('div.layui-form-checkbox').attr('class').indexOf('layui-form-checked') === -1) {
                            stamil[index].checkd = false
                        } else {
                            milcheckbox.each(function (i, t) {
                                if ($(this).attr('pid') === $(item).attr('stageid')) {
                                    var boxes = $(this).find('li .layui-form-checkbox')
                                    var val = $(this).find('li div input')
                                    val.each(function (a, b) {
                                        if ($(this).val()) {
                                            stamil[index].milepostlist[a].num = $(this).val()
                                        } else {
                                            stamil[index].milepostlist[a].num = 0
                                        }
                                    })
                                    boxes.each(function (x, m) {
                                        if ($(this).attr('class').indexOf('layui-form-checked') === -1) {
                                            stamil[index].milepostlist[x].checkd = false
                                        }
                                    })
                                }
                            })
                        }
                    })

                    var total, is_true;
                    is_true = true;
                    for (var i = 0; i < stamil.length; i++) {
                        console.log(stamil[i])
                        if (stamil[i].checkd) {
                            total = 0;
                            for (var m = 0; m < stamil[i].milepostlist.length; m++) {
                                if (stamil[i].milepostlist[m].checkd) {
                                    total += parseFloat(stamil[i].milepostlist[m].num)
                                }
                            }
                            if (total !== 100) {
                                is_true = false
                                $('#btnsubmit').removeClass("layui-btn-disabled").attr("disabled", false);
                                layer.msg(stamil[i].stagename + "的里程比例不等于100%", {icon: 2});
                                return false;
                            }
                        }
                    }
                    return is_true;
                },
                createbeforeBjy: function (data) {
                    var isTg = true;
                    var value = xmselectxmjl.getValue('valueStr');
                    if (!value) {
                        layer.msg("请选择咨询项目经理", {icon: 2});
                        isTg = false;
                        return isTg;
                    }
                    return isTg;
                },
                createbefore: function (data) {
                    var isTg = true;
                    var value= xmselectxmjl.getValue('valueStr');
                    if(!value){
                        layer.msg("请选择咨询项目经理", {icon: 2});
                        isTg = false;
                        return isTg;
                    }
                    var valuezjl= xmselecthyfzr.getValue('valueStr');
                    if(!valuezjl){
                        layer.msg("请选择行业负责人", {icon: 2});
                        isTg = false;
                        return isTg;
                    }
                    var valuejfsz= xmselectjsfzr.getValue('valueStr');
                    if(!valuejfsz){
                        layer.msg("请选择技术负责人", {icon: 2});
                        isTg = false;
                        return isTg;
                    }
                    var valuecom= xmselectcompany.getValue('valueStr');
                    if(!valuecom){
                        layer.msg("请选择咨询单位", {icon: 2});
                        isTg = false;
                        return isTg;
                    }
                    $("#zbjd").find("[type=checkbox]:checked").each(function (i, v) {
                        var stageId = $(v).parent().attr("stageid");
                        var _mul = $("#dvmilepost").find("ul[pid=" + stageId + "]");
                        var open = $(_mul).find(".open");
                        var count = 0;
                        open.each(function (i, v) {
                            var value = $(v).attr("value");
                            if (value == "1") {
                                count++;
                            }
                        })
                        if (count == 0) {
                            var jdname = $(v).parent().find("span").html();
                            layer.msg(jdname + "，必须选择一个里程节点", {icon: 2});
                            isTg = false;
                            return isTg;
                        }
                    });
                    //校验分包编号值不能重复：
                    var ssses = $("#FB").find(".sss");
                    if( data && data.field && ssses.length>0){
                        data.field.fbNum = ssses.length;
                        var values = [];
                        for(var a=0;a<ssses.length;a++){
                            var aVal = $(ssses[a]).val();
                            if(values.indexOf(aVal)>-1){
                                layer.msg("操作失败，有重复的分包名称--"+aVal, {icon: 2});
                                isTg = false;
                                return isTg;
                            }else{
                                values.push(aVal);
                            }
                        }
                    }
                    return isTg;
                },
                create: function (data) {
                    console.log("保存中...");
                    /*按钮至灰色不能用，防止重复提交*/
                    $('#btnsave').addClass("layui-btn-disabled").attr("disabled", true);
                    var  istg;
                    var istab = true;
                    var isyz=true;
                    if("${prj.status}" == "001"){
                        _crt_page.tables.getTableDataBjy(data);
                        istg=_crt_page.forms.createbeforeBjy(data);
                    }else{
                        isyz=_crt_page.forms.totals();
                        if(!isyz){
                            $('#btnsave').removeClass("layui-btn-disabled").attr("disabled", false);
                            return false ;
                        }
                        istab =  _crt_page.tables.getTableData(data);
                        if(biliTotal!='100%'){
                            $('#btnsave').removeClass("layui-btn-disabled").attr("disabled", false);
                            layer.msg("付款比例不等于100%",{icon:2});
                            return false;
                        }
                        var jd=$("#zbjd").find('li').length;
                        if(jd>0 && jd==1){
                            if(data.field["zxProjectStages[0].endDate"]<data.field["zxProjectStages[0].startDate"]){
                                $('#btnsubmit').removeClass("layui-btn-disabled").attr("disabled", false);
                                layer.msg("结束时间不能小于最后阶段的起始时间",{icon:2});
                                return false;
                            }
                        }else if(jd==2){
                            if(data.field["zxProjectStages[0].endDate"]<data.field["zxProjectStages[0].startDate"]){
                                $('#btnsubmit').removeClass("layui-btn-disabled").attr("disabled", false);
                                layer.msg("结束时间不能小于最后阶段的起始时间",{icon:2});
                                return false;
                            }
                            if(data.field["zxProjectStages[1].endDate"]<data.field["zxProjectStages[1].startDate"]){
                                $('#btnsubmit').removeClass("layui-btn-disabled").attr("disabled", false);
                                layer.msg("结束时间不能小于最后阶段的起始时间",{icon:2});
                                return false;
                            }
                        }else if(jd==3){
                            if(data.field["zxProjectStages[0].endDate"]<data.field["zxProjectStages[0].startDate"]){
                                $('#btnsubmit').removeClass("layui-btn-disabled").attr("disabled", false);
                                layer.msg("结束时间不能小于最后阶段的起始时间",{icon:2});
                                return false;
                            }
                            if(data.field["zxProjectStages[1].endDate"]<data.field["zxProjectStages[1].startDate"]){
                                $('#btnsubmit').removeClass("layui-btn-disabled").attr("disabled", false);
                                layer.msg("结束时间不能小于最后阶段的起始时间",{icon:2});
                                return false;
                            }
                            if(data.field["zxProjectStages[2].endDate"]<data.field["zxProjectStages[2].startDate"]){
                                $('#btnsubmit').removeClass("layui-btn-disabled").attr("disabled", false);
                                layer.msg("结束时间不能小于最后阶段的起始时间",{icon:2});
                                return false;
                            }
                        }else if(jd==4){
                            if(data.field["zxProjectStages[0].endDate"]<data.field["zxProjectStages[0].startDate"]){
                                $('#btnsubmit').removeClass("layui-btn-disabled").attr("disabled", false);
                                layer.msg("结束时间不能小于最后阶段的起始时间",{icon:2});
                                return false;
                            }
                            if(data.field["zxProjectStages[1].endDate"]<data.field["zxProjectStages[1].startDate"]){
                                $('#btnsubmit').removeClass("layui-btn-disabled").attr("disabled", false);
                                layer.msg("结束时间不能小于最后阶段的起始时间",{icon:2});
                                return false;
                            }
                            if(data.field["zxProjectStages[2].endDate"]<data.field["zxProjectStages[2].startDate"]){
                                $('#btnsubmit').removeClass("layui-btn-disabled").attr("disabled", false);
                                layer.msg("结束时间不能小于最后阶段的起始时间",{icon:2});
                                return false;
                            }
                            if(data.field["zxProjectStages[3].endDate"]<data.field["zxProjectStages[3].startDate"]){
                                $('#btnsubmit').removeClass("layui-btn-disabled").attr("disabled", false);
                                layer.msg("结束时间不能小于最后阶段的起始时间",{icon:2});
                                return false;
                            }
                        }
                        istg=_crt_page.forms.createbefore(data);
                    }
                    data.field.status='001';
                    if(istg && istab  && isyz){
                        data.field.projectManagerPerson = xmselectxmjl.getValue('valueStr');
                        data.field.industryPerson = xmselecthyfzr.getValue('valueStr');
                        data.field.zxAdviser = xmselectzxgw.getValue('valueStr');
                        data.field.supervisorCompany = xmselectcompany.getValue('valueStr');
                        data.field.technologyPerson = xmselectjsfzr.getValue('valueStr');
                        console.log(data.field);
                        layerAjax('/zx/projectCreate/createupdate', data.field, '', function (d) {
                            if (d.flag == true) {
                                layer.msg(d.msg, {icon: 1});
                                setTimeout(tzym,2000)
                            } else {
                                layer.msg(d.msg, {icon: 2});
                            }
                        });
                    }else{
                        $('#btnsave').removeClass("layui-btn-disabled").attr("disabled", false);
                        $('#btnsubmit').removeClass("layui-btn-disabled").attr("disabled", false);
                    }

                    return false;
                },
                submit: function (data) {
                    /*按钮至灰色不能用，防止重复提交*/
                    $('#btnsubmit').addClass("layui-btn-disabled").attr("disabled", true);
                    var _pay_data = _crt_page.tables.getTableData(data);
                    data.field.status='002';
                    var  isyz=_crt_page.forms.totals();
                    if(!isyz){
                        $('#btnsubmit').removeClass("layui-btn-disabled").attr("disabled", false);
                        return  false;
                    }
                    if(biliTotal!='100%'){
                        $('#btnsubmit').removeClass("layui-btn-disabled").attr("disabled", false);
                        layer.msg("付款比例不等于100%",{icon:2});
                        return false;
                    }
                    var jd=$("#zbjd").find('li').length;
                    if(jd>0 && jd==1){
                        if(data.field["zxProjectStages[0].endDate"]<data.field["zxProjectStages[0].startDate"]){
                            $('#btnsubmit').removeClass("layui-btn-disabled").attr("disabled", false);
                            layer.msg("结束时间不能小于最后阶段的起始时间",{icon:2});
                            return false;
                        }
                    }else if(jd==2){
                        if(data.field["zxProjectStages[0].endDate"]<data.field["zxProjectStages[0].startDate"]){
                            $('#btnsubmit').removeClass("layui-btn-disabled").attr("disabled", false);
                            layer.msg("结束时间不能小于最后阶段的起始时间",{icon:2});
                            return false;
                        }
                        if(data.field["zxProjectStages[1].endDate"]<data.field["zxProjectStages[1].startDate"]){
                            $('#btnsubmit').removeClass("layui-btn-disabled").attr("disabled", false);
                            layer.msg("结束时间不能小于最后阶段的起始时间",{icon:2});
                            return false;
                        }
                    }else if(jd==3){
                        if(data.field["zxProjectStages[0].endDate"]<data.field["zxProjectStages[0].startDate"]){
                            $('#btnsubmit').removeClass("layui-btn-disabled").attr("disabled", false);
                            layer.msg("结束时间不能小于最后阶段的起始时间",{icon:2});
                            return false;
                        }
                        if(data.field["zxProjectStages[1].endDate"]<data.field["zxProjectStages[1].startDate"]){
                            $('#btnsubmit').removeClass("layui-btn-disabled").attr("disabled", false);
                            layer.msg("结束时间不能小于最后阶段的起始时间",{icon:2});
                            return false;
                        }
                        if(data.field["zxProjectStages[2].endDate"]<data.field["zxProjectStages[2].startDate"]){
                            $('#btnsubmit').removeClass("layui-btn-disabled").attr("disabled", false);
                            layer.msg("结束时间不能小于最后阶段的起始时间",{icon:2});
                            return false;
                        }
                    }else if(jd==4){
                        if(data.field["zxProjectStages[0].endDate"]<data.field["zxProjectStages[0].startDate"]){
                            $('#btnsubmit').removeClass("layui-btn-disabled").attr("disabled", false);
                            layer.msg("结束时间不能小于最后阶段的起始时间",{icon:2});
                            return false;
                        }
                        if(data.field["zxProjectStages[1].endDate"]<data.field["zxProjectStages[1].startDate"]){
                            $('#btnsubmit').removeClass("layui-btn-disabled").attr("disabled", false);
                            layer.msg("结束时间不能小于最后阶段的起始时间",{icon:2});
                            return false;
                        }
                        if(data.field["zxProjectStages[2].endDate"]<data.field["zxProjectStages[2].startDate"]){
                            $('#btnsubmit').removeClass("layui-btn-disabled").attr("disabled", false);
                            layer.msg("结束时间不能小于最后阶段的起始时间",{icon:2});
                            return false;
                        }
                        if(data.field["zxProjectStages[3].endDate"]<data.field["zxProjectStages[3].startDate"]){
                            $('#btnsubmit').removeClass("layui-btn-disabled").attr("disabled", false);
                            layer.msg("结束时间不能小于最后阶段的起始时间",{icon:2});
                            return false;
                        }
                    }
                    var  istg=_crt_page.forms.createbefore(data);
                    data.field.status = "002";
                    if (istg && _pay_data  && isyz) {
                        data.field.projectManagerPerson = xmselectxmjl.getValue('valueStr');
                        data.field.industryPerson = xmselecthyfzr.getValue('valueStr');
                        data.field.zxAdviser = xmselectzxgw.getValue('valueStr');
                        data.field.supervisorCompany = xmselectcompany.getValue('valueStr');
                        data.field.technologyPerson = xmselectjsfzr.getValue('valueStr');
                        console.log(data.field);
                        layerAjax('/zx/projectCreate/createupdate', data.field, '', function (d) {
                            if (d.flag == true) {
                                layer.msg(d.msg, {icon: 1});
                                setTimeout(tzym,2000)
                            } else {
                                $('#btnsubmit').removeClass("layui-btn-disabled").attr("disabled", false);
                                layer.msg(d.msg, {icon: 2});
                            }
                        });
                    }else{
                        $('#btnsave').removeClass("layui-btn-disabled").attr("disabled", false);
                        $('#btnsubmit').removeClass("layui-btn-disabled").attr("disabled", false);
                    }

                    return false;
                },
                selects: {
                    _init: function () {
                        // _crt_page.packages.getpackages();
                        // $(".enterpriseUnit .slt").each(function (i, v) {
                        //     //项目负责人
                        //     _crt_page.forms.selects._intSlt(i, 'slt', false, 'projectLeaders[' + i + '].leaderFbNumber');
                        // });
                        _crt_page.forms.selects._intSltxmjl();
                        //监理单位
                               /* $("#supervisorCompany").change(_crt_page.forms.selects.companychange);*/
                    },
                    _intSlt: function (a, b, c, d) {
                        var _a = $('#' + b + a).attr("value"), _b;
                        if (_a) {
                            _b = _a.split(',');
                        }
                        var disable = ("${hyfzr}"=="true") || ("${xmjl}" == "1");
                        var _xst = xmSelect.render({
                            el: '#' + b + a,
                            name: d ? d : 'projectLeaders[' + a + '].leaderFbNumber',
                            radio: c ? c : false,
                            toolbar:{show: false},
                            layVerType: 'msg',
                            data: _gpakgs,
                            strict: true,
                            initValue: _b,
                        });

                        $('#' + b + a).find('xm-select').off('click').click(function () {
                            var idfalg=b + a;
                            if(idfalg.indexOf("slt")!=-1){
                                _crt_page.forms.selects.deleteSelect("#FZR",".slt");
                            }
                            var _a = $(this).parent().attr('class');
                            var _b = _xst.getValue();
                            setTimeout(function(){
                                _xst.update({data: _gpakgs});
                                _xst.setValue(_b);
                            },100);
                        });

                    },
                    _intSltxmjl:function(){

                        layerAjaxGet("/zx/projectCreate/getCompany",{},"",function (d){
                            var rows=null;
                            if(d.flag){
                                if(d.data){
                                    rows=d.data;
                                }
                                if(rows){
                                    var _ycols = ['bcId', 'bcName'];
                                    var companysz=[];
                                    $.each(rows,function (i,v){
                                        var supervisorCompany= "${prj.supervisorCompany}";
                                        var  values=v[_ycols[0]];
                                        if(values==supervisorCompany){
                                            companysz.push({name:v[_ycols[1]],value:v[_ycols[0]],selected: true});
                                        }else{
                                            companysz.push({name:v[_ycols[1]],value:v[_ycols[0]]});
                                        }

                                    })
                                    // 公司
                                    var disableCom = !("${xmjl}" == "1" && ("${prj.status}" == "001"));
                                    xmselectcompany= xmSelect.render({
                                        el: '#supervisorCompany',
                                        filterable: true,
                                        disabled: disableCom,
                                        radio: true,
                                        toolbar: {show: false},
                                        layVerType: 'msg',
                                        on: function(data){
                                            if(data && data.arr.length>0){
                                                _crt_page.forms.selects.companychange(data.arr[0].value);
                                            }

                                        },
                                        data: companysz
                                    })
                                }
                            }

                        });

                        var _ycols = ['id', 'realName'];
                        var supervisorCompany= "${prj.supervisorCompany}";
                        layerAjaxGet("/user/getdicts",{ companyName: supervisorCompany, userRole: 'zxdwjsfzr'},"",function (d){
                            var rows=null;
                            if(d.code==200){
                                if(d.data){
                                    rows=d.data;
                                }
                                if(rows){
                                    var jsfzr=[];
                                    $.each(rows,function (i,v){
                                        var technologyPerson= "${prj.technologyPerson}";
                                        var  values=v[_ycols[0]];
                                        if(values==technologyPerson){
                                            jsfzr.push({name:v[_ycols[1]],value:v[_ycols[0]],selected: true});
                                        }else{
                                            jsfzr.push({name:v[_ycols[1]],value:v[_ycols[0]]});
                                        }
                                    })
                                    // 绑定技术负责人下拉
                                    var disableTe = !("${xmjl}" == "1" && ("${prj.status}" == "001"));
                                    xmselectjsfzr= xmSelect.render({
                                        el: '#technologyPerson',
                                        filterable: true,
                                        disabled: disableTe,
                                        radio: true,
                                        toolbar: {show: false},
                                        layVerType: 'msg',
                                        data: jsfzr
                                    })
                                }
                            }

                        });
                        layerAjaxGet("/user/getdicts",{ companyName: supervisorCompany, userRole: 'zxdwhyfzr'},"",function (d){
                            var rows=null;
                            if(d.code==200){
                                if(d.data){
                                    rows=d.data;
                                }
                                if(rows){
                                    var zjlgcs=[];
                                    $.each(rows,function (i,v){
                                        var industryPerson= "${prj.industryPerson}";
                                        var  values=v[_ycols[0]];
                                        if(values==industryPerson){
                                            zjlgcs.push({name:v[_ycols[1]],value:v[_ycols[0]],selected: true});
                                        }else{
                                            zjlgcs.push({name:v[_ycols[1]],value:v[_ycols[0]]});
                                        }

                                    })
                                    // 绑定行业负责人
                                   // var disableZjl = !(("${hyfzr}" == "true" && ("${prj.status}" != "001")) || "${prj.status}" != "003");
                                    var disable2=false;
                                    if("${prj.status}"=='001'){
                                        disable2=false;
                                    }else{
                                        disable2 = !(("${hyfzr}" == "true" && ("${prj.status}" != "001")) && "${prj.status}" != "003");
                                    }
                                    <#--var disable2 = !(("${hyfzr}" == "true" && ("${prj.status}" != "001")) && "${prj.status}" != "003");-->
                                    xmselecthyfzr= xmSelect.render({
                                        el: '#industryPerson',
                                        filterable: true,
                                        radio: true,
                                        disabled: disable2,
                                        toolbar: {show: false},
                                        layVerType: 'msg',
                                        data: zjlgcs
                                    })
                                }
                            }

                        });
                        layerAjaxGet("/user/getdicts",{ companyName: supervisorCompany, userRole: 'zxgw'},"",function (d){
                            var rows=null;
                            if(d.code==200){
                                if(d.data){
                                    rows=d.data;
                                }
                                if(rows){
                                    var zxgw=[];
                                    $.each(rows,function (i,v){
                                        var boo = true;
                                        var zxAdviser= "${prj.zxAdviser}";
                                        var  values=v[_ycols[0]];
                                        var jcgwArr = zxAdviser.split(",");
                                        for(var x = 0;x<jcgwArr.length;x++){
                                            var jcgwStr = jcgwArr[x];
                                            if(values==jcgwStr){
                                                zxgw.push({name:v[_ycols[1]],value:v[_ycols[0]],selected: true});
                                                boo = false;
                                            }
                                        }
                                        if(boo){
                                            zxgw.push({name:v[_ycols[1]],value:v[_ycols[0]]});
                                        }
                                        /*if(zxAdviser.indexOf(values) > 0){
                                            zxgw.push({name:v[_ycols[1]],value:v[_ycols[0]],selected: true});
                                        }else{
                                            zxgw.push({name:v[_ycols[1]],value:v[_ycols[0]]});
                                        }*/

                                    })
                                    // 绑定总监理工程师下拉
                                    var disableZxgw = (!("${prj.status}" != "003"));
                                    xmselectzxgw= xmSelect.render({
                                        el: '#zxAdviser',
                                        filterable: true,
                                        // radio: false,
                                        disabled: disableZxgw,
                                        toolbar: {show: true},
                                        layVerType: 'msg',
                                        data: zxgw
                                    })
                                }
                            }

                        });
                        var xmjlry=[];

                        xmselectxmjl= xmSelect.render({
                            el: '#projectManagerPerson',
                            filterable: true,
                            radio: true,
                            toolbar: {show: false},
                            layVerType: 'msg',
                            data: xmjlry
                        })

                        layerAjaxGet("/user/getdicts",{ companyName: supervisorCompany, userRole: 'zxxmjl'},"",function (d){
                            var rows=null;
                            if(d.code==200){
                                if(d.data){
                                    rows=d.data;
                                }
                                if(rows){
                                    var xmjlry=[];
                                    $.each(rows,function (i,v){
                                        var projectManagerPerson= "${prj.projectManagerPerson}";
                                        var  values=v[_ycols[0]];
                                        if(projectManagerPerson==values){
                                            xmjlry.push({name:v[_ycols[1]],value:v[_ycols[0]],selected: true});
                                        }else{
                                            xmjlry.push({name:v[_ycols[1]],value:v[_ycols[0]]});
                                        }
                                    })
                                    // 绑定项目经理下拉
                                    var disable2=false;
                                    if("${prj.status}"=='001'){
                                         disable2=false;
                                    }else{
                                         disable2 = !(("${hyfzr}" == "true" && ("${prj.status}" != "001")) && "${prj.status}" != "003");
                                    }
                                    xmselectxmjl= xmSelect.render({
                                        el: '#projectManagerPerson',
                                        filterable: true,
                                        radio: true,
                                        disabled: disable2,
                                        toolbar: {show: false},
                                        layVerType: 'msg',
                                        data: xmjlry
                                    })
                                }
                            }
                        });
                    },
                    deleteSelect:function(id,selectclass){
                        $(id).find(selectclass).each(function (i, v) {
                            var  title=$(v).find(".label-content").attr("title");
                            var arrselect = title.split(',');
                            for(var y=0;y<arrselect.length;y++){
                                for(var i=0;i<_gpakgs.length;i++){
                                    var selectele= _gpakgs[i];
                                    var pavalue=selectele.value;
                                    if(arrselect[y].indexOf(pavalue)!=-1){
                                        _gpakgs.splice(i,1)
                                    }
                                }
                            }
                        });
                    },
                    companychange: function (_comid) {
                        var _comid = _comid;
                        if (_comid) {
                            var _ycols = ['id', 'realName'];
                            layerAjaxGet("/user/getdicts", {companyName: _comid, userRole: 'zxdwjsfzr'}, "", function (d) {
                                var rows = null;
                                if (d.code == 200) {
                                    if (d.data) {
                                        rows = d.data;
                                    }
                                    if(rows){
                                        var jsfzr=[];
                                        $.each(rows,function (i,v){
                                            if(i==0){
                                                jsfzr.push({name:v[_ycols[1]],value:v[_ycols[0]],selected: true});
                                            }else{
                                                jsfzr.push({name:v[_ycols[1]],value:v[_ycols[0]]});
                                            }
                                        })
                                        // 绑定技术负责人下拉
                                        xmselectjsfzr= xmSelect.render({
                                            el: '#technologyPerson',
                                            filterable: true,
                                            radio: true,
                                            toolbar: {show: false},
                                            layVerType: 'msg',
                                            data: jsfzr
                                        })
                                    }
                                }

                            });

                            layerAjaxGet("/user/getdicts", {companyName: _comid, userRole: 'zxdwhyfzr'}, "", function (d) {
                                var rows = null;
                                if (d.code == 200) {
                                    if (d.data) {
                                        rows = d.data;
                                    }
                                    if (rows) {
                                        var hyfzr = [];
                                        $.each(rows, function (i, v) {
                                            if (i == 0) {
                                                hyfzr.push({name: v[_ycols[1]], value: v[_ycols[0]], selected: true});
                                            } else {
                                                hyfzr.push({name: v[_ycols[1]], value: v[_ycols[0]]});
                                            }

                                        })
                                        // 绑定行业负责人
                                        xmselecthyfzr = xmSelect.render({
                                            el: '#industryPerson',
                                            filterable: true,
                                            radio: true,
                                            toolbar: {show: false},
                                            layVerType: 'msg',
                                            data: hyfzr
                                        })
                                    }
                                }

                            });
                            layerAjaxGet("/user/getdicts", {companyName: _comid, userRole: 'zxgw'}, "", function (d) {
                                var rows = null;
                                if (d.code == 200) {
                                    if (d.data) {
                                        rows = d.data;
                                    }
                                    if (rows) {
                                        var zxgw = [];
                                        $.each(rows, function (i, v) {
                                            if (i == 0) {
                                                zxgw.push({name: v[_ycols[1]], value: v[_ycols[0]], selected: true});
                                            } else {
                                                zxgw.push({name: v[_ycols[1]], value: v[_ycols[0]]});
                                            }
                                        })
                                        console.log(zxgw);
                                        // 绑定咨询顾问下拉
                                        xmselectzxgw = xmSelect.render({
                                            el: '#zxAdviser',
                                            filterable: true,
                                            radio: true,
                                            toolbar: {show: false},
                                            layVerType: 'msg',
                                            data: zxgw
                                        })
                                    }
                                }

                            });
                            layerAjaxGet("/user/getdicts", {companyName: _comid, userRole: 'zxxmjl'}, "", function (d) {
                                var rows = null;
                                if (d.code == 200) {
                                    if (d.data) {
                                        rows = d.data;
                                    }
                                    if(rows){
                                        var xmjlry=[];
                                        var projectManagerPerson= "${prj.projectManagerPerson}";
                                        $.each(rows,function (i,v){
                                            var  values=v[_ycols[0]];
                                            if(projectManagerPerson==values){
                                                xmjlry.push({name:v[_ycols[1]],value:v[_ycols[0]],selected:true});
                                            }else{
                                                xmjlry.push({name:v[_ycols[1]],value:v[_ycols[0]]});
                                            }
                                        })
                                        // 绑定项目经理下拉
                                        xmselectxmjl= xmSelect.render({
                                            el: '#projectManagerPerson',
                                            filterable: true,
                                            radio: true,
                                            toolbar: {show: false},
                                            layVerType: 'msg',
                                            data: xmjlry
                                        })
                                    }
                                }

                            });
                        } else {
                            var jsfzr = [];
                            xmselectjsfzr.update({data: jsfzr});
                            var hyfzr = [];
                            xmselecthyfzr.update({data: hyfzr});
                            var xmjlry = [];
                            xmselectxmjl.update({data: xmjlry});
                            var zxgw = [];
                            xmselectzxgw.update({data: zxgw});

                        }
                    }
                }
            },
            tables: {
                _init: function () {
                    var fkfs = "${prj.fkType}";
                    if(fkfs == "1"){
                        _crt_page.tables.renderTable(false,true);
                    }else if(fkfs == "2"){
                        _crt_page.tables.renderTable(true,false);
                    }else {
                        _crt_page.tables.renderTable(false,true);
                    }
                },
                _dels: [],
                renderTable: function (fkjd,fksj) {
                    var fksj=fksj;
                    layui.use(['table'], function () {
                        table = layui.table;
                        layerAjaxGet('/zx/projectCreate/getlistbyprjid', {sppPrjid: '${prj.id}'}, '', function (d) {
                            var _data = d.data;
                            table.render({
                                elem: '#payways',
                                id: 'payways',
                                cellMinWidth: 80,
                                totalRow: true,
                                <#if !(("${hyfzr}" == "true" && ("${prj.status}" == "001")))>toolbar: '#toolbarDemo',</#if>
                                defaultToolbar: false,
                                height: '300px',
                                cols: [[
<#--                                    <#if (!("${hyfzr}" == "true" && ("${prj.status}" == "001")))>{type: 'checkbox', fixed: 'left'},</#if>-->
                                    {field: 'sppId', hide: true},
                                    {
                                        field: 'sppNo',
                                        align: 'center',
                                        title: '付款次数',
                                        <#if !("${xmjl}" == "1" && ("${prj.status}" != "001"))>edit: 'text',</#if>
                                        totalRowText: '合计',
                                        width: 100
                                    },
                                    {field: 'sppNode', align: 'center', title: '付款节点', minWidth: 120, event: 'node',hide:true},
                                    {field: 'nodeOrder', align: 'center', title: '里程序号', minWidth: 120,hide:true},
                                    {field: 'milepostName', align: 'center', title: '付款节点<span style="color: red">*</span>', hide: fkjd,minWidth: 120, event: 'node'},
                                    {field: 'payDate', align: 'center', title: '付款时间<span style="color: red">*</span>',hide: fksj, minWidth: 120, event: 'editStartDate'},
                                    {
                                        field: 'sppPersent',
                                        align: 'center',
                                        title: '付款比例<span style="color: red">*</span>',
                                        <#if ("${prj.status}" != "003")>edit: 'text',</#if>
                                        totalRow: true,
                                        width: 200,
                                        event: 'persent'
                                    },
                                    {
                                        field: 'payMoney',
                                        align: 'center',
                                        title: '付款金额<span style="color: red">*</span>',
                                        <#if ("${prj.status}" != "003")>edit: 'text',</#if>
                                        totalRow: true,
                                        width: 200,
                                        event: 'payMoney'
                                    }
                                    <#if ("${prj.status}" != "003")>, {fixed: 'right', title: '操作', toolbar: '#barDemo', width: 150}</#if>
                                ]],
                                data: _data,
                                done: function(res, curr, count) {
                                    $(".layui-input-date").each(function (i) {
                                        layui.laydate.render({
                                            elem: this,
                                            format: "yyyy-MM-dd",
                                            trigger: 'click',
                                            done: function (value, date) {

                                            }
                                        });


                                    });
                                    var str = 5;
                                    if((!("${hyfzr}" == "true" && ("${prj.status}" == "001")))){
                                        str = 6;
                                    }
                                    /*处理合计*/
                                    var  totaldiv=$(".layui-table-total").find("tbody").find("td[data-field='sppPersent']").find("div");
                                    var totalsz=  totaldiv.html();
                                    totaldiv.html(parseFloat(totalsz)+"%");
                                    biliTotal=parseFloat(totalsz)+"%";
                                }
                            });
                            /*    if("${hyfzr}"!="true"){*/
                            //监听单元格事件
                            table.on('tool(payways)', _crt_page.tables.events.tool);
                            //监听单元格编辑
                            table.on('edit(payways)', _crt_page.tables.events.edit);
                            //头工具栏事件
                            table.on('toolbar(payways)', _crt_page.tables.events.toolbar);
                            /*     }*/
                        })
                    });
                },
                getTableDataBjy: function (data) {
                    var tabledata = layui.table.cache.payways;
                    var _aln = tabledata.length;
                    var ind = 0;
                    var fkfs = $("select#fkfs.fl").val();
                    data.field.fkType = fkfs;
                    for (var i = 0; i < _aln; i++) {
                        var _itm = tabledata[i];
                        data.field['payList[' + ind + '].sppId'] = _itm.sppId;
                        data.field['payList[' + ind + '].sppNo'] = _itm.sppNo;
                        data.field['payList[' + ind + '].sppNode'] = _itm.sppNode;
                        data.field['payList[' + ind + '].sppPersent'] = _itm.sppPersent;
                        data.field['payList[' + ind + '].payDate'] = _itm.payDate;
                        data.field['payList[' + ind + '].payMoney'] = _itm.payMoney;
                        data.field['payList[' + ind + '].nodeOrder'] = _itm.nodeOrder;
                        ind ++;
                    }
                    var _i = _crt_page.tables._dels.length;
                    if (_i > 0) {
                        for (var i = 0; i < _i; i++) {
                            var _a = _crt_page.tables._dels[i];
                            data.field['payList[' + (ind + i) + '].sppId'] = _a.sppId;
                            data.field['payList[' + (ind + i) + '].sppNo'] = _a.sppNo;
                            data.field['payList[' + (ind + i) + '].sppNode'] = _a.sppNode;
                            data.field['payList[' + (ind + i) + '].sppPersent'] = _a.sppPersent;
                            data.field['payList[' + (ind + i) + '].payDate'] = _a.payDate;
                            data.field['payList[' + (ind + i) + '].payMoney'] = _a.payMoney;
                            data.field['payList[' + (ind + i) + '].nodeOrder'] = _a.nodeOrder;
                            data.field['payList[' + (ind + i) + '].sppNote'] = '-1';
                            ind ++;
                        }
                    }
                    return true;
                },
                getTableData: function (data) {
                    var tabledata = layui.table.cache.payways;
                    var _aln = tabledata.length;
                    var ind = 0;
                    var fkfs = $("select#fkfs.fl").val();
                    data.field.fkType = fkfs;
                    for (var i = 0; i < _aln; i++) {
                        var _itm = tabledata[i];
                        if(fkfs == "1"){
                            if (!_itm.sppNode || !_itm.sppPersent) {
                                layer.msg("付款节点或付款比例不能为空", {icon: 2});
                                return false;
                            }
                        }else{
                            if (!_itm.payDate) {
                                layer.msg("付款时间不能为空", {icon: 2});
                                return false;
                            }
                        }
                        data.field['payList[' + ind + '].sppId'] = _itm.sppId;
                        data.field['payList[' + ind + '].sppNo'] = _itm.sppNo;
                        data.field['payList[' + ind + '].sppNode'] = _itm.sppNode;
                        data.field['payList[' + ind + '].sppPersent'] = _itm.sppPersent;
                        data.field['payList[' + ind + '].payDate'] = _itm.payDate;
                        data.field['payList[' + ind + '].payMoney'] = _itm.payMoney;
                        data.field['payList[' + ind + '].nodeOrder'] = _itm.nodeOrder;
                        ind ++;
                    }
                    var _i = _crt_page.tables._dels.length;
                    if (_i > 0) {
                        for (var i = 0; i < _i; i++) {
                            var _a = _crt_page.tables._dels[i];
                            data.field['payList[' + (ind + i) + '].sppId'] = _a.sppId;
                            data.field['payList[' + (ind + i) + '].sppNo'] = _a.sppNo;
                            data.field['payList[' + (ind + i) + '].sppNode'] = _a.sppNode;
                            data.field['payList[' + (ind + i) + '].sppPersent'] = _a.sppPersent;
                            data.field['payList[' + (ind + i) + '].payDate'] = _a.payDate;
                            data.field['payList[' + (ind + i) + '].payMoney'] = _a.payMoney;
                            data.field['payList[' + (ind + i) + '].nodeOrder'] = _a.nodeOrder;
                            data.field['payList[' + (ind + i) + '].sppNote'] = '-1';
                            ind ++;
                        }
                    }
                    return true;
                },
                events: {
                    tool: function (obj) {
                        var fksj=fksj;
                        var data = obj.data;
                        switch (obj.event) {
                            case 'node':
                                if("${prj.status}" != "001" && "${prj.status}" != "003"){
                                    if(data.sppId != "" && data.sppId != null && data.sppId != undefined){
                                        return false;
                                    }
                                }
                                layer.open({
                                    title: '请选择付款节点',
                                    content: _crt_page.stages.getmilestoneselects(), //这里content是一个DOM，注意：最好该元素要存放在body最外层，否则可能被其它的相对元素所影响
                                    yes: function (index, layero) {
                                        //如果设定了yes回调，需进行手工关闭
                                        layer.close(index);
                                        var milepostname=$("#selmilepost option:selected").text();
                                        var nodeOrder=$("#selmilepost option:selected").attr("layorder");
                                        var  tabledata=layui.table.cache.payways;
                                        var _aln = tabledata.length;
                                        var currSppNo=data.sppNo;
                                        for (var i = 0; i < _aln; i++) {
                                            var _itm = tabledata[i];
                                            if($("#selmilepost").val()==_itm.sppNode){
                                                layer.msg("付款节点不允许重复", {icon: 2});
                                                return ;
                                            }
                                            if(currSppNo>_itm.sppNo){
                                                if(Number(nodeOrder)<Number(_itm.nodeOrder) && _itm.nodeOrder){
                                                    layer.msg("选择的付款节点必须在前一个付款节点之后", {icon: 2});
                                                    return ;
                                                }
                                            }else if(currSppNo<_itm.sppNo){
                                                if(Number(nodeOrder)>Number(_itm.nodeOrder) && _itm.nodeOrder){
                                                    layer.msg("选择的付款节点必须在后一个付款节点之前", {icon: 2});
                                                    return ;
                                                }
                                            }
                                        }
                                        obj.update({
                                            milepostName: milepostname,
                                            nodeOrder:nodeOrder,
                                            sppNode: $("#selmilepost").val()
                                        });
                                    }
                                });
                                break;
                            case 'del':
                                layer.confirm('确定删除？', function (index) {
                                    var   status="${prj.status}";
                                    if(status!='001'){
                                        if (data.sppId) {
                                            layer.msg("已经保存的不能删除", {icon: 2});
                                            return false;
                                            layer.close(index);
                                        }
                                    }
                                    _crt_page.tables._dels.push(data);
                                    var oldData = table.cache.payways;
                                    $.each(oldData,function(ind,item){
                                        if(item.sppNo*1 == obj.data.sppNo*1){
                                            oldData.splice(ind,1);//删除缓存的行
                                            //跳出循环
                                            return false;
                                        }
                                    })
                                    $.each(oldData,function(ind,item){
                                        item.sppNo = ind+1;
                                    })
                                    table.reload("payways", {data: oldData})
                                    layer.close(index);
                                });
                                break;
                            case 'editStartDate':
                                if("${prj.status}" != "001" && "${prj.status}" != "003"){
                                    if(data.sppId != "" && data.sppId != null && data.sppId != undefined){
                                        return false;
                                    }
                                }
                                var field = $(this).data('field');
                                if(!fksj){
                                    laydate.render({
                                        elem: this.firstChild
                                        , show: true //直接显示
                                        , closeStop: this
                                        , done: function (value, date) {
                                            data[field] = value;
                                            obj.update(data);
                                        }
                                    });
                                }
                                break;
                        }
                    },
                    edit: function (obj) {
                        if (obj.field == 'sppPersent') {
                            var  per=obj.data.sppPersent;
                            if(per.indexOf("%")<0){
                                obj.update({
                                    sppPersent: per+"%"
                                });
                            }
                            var htMoney=$("#htMoney").val();
                            if(htMoney){
                                var money=(htMoney*((parseFloat(per.replace("%","")))/100)).toFixed(2);
                                obj.update({
                                    payMoney: money
                                });
                            }
                            table.reload("payways", {data: table.cache.payways});
                        }
                        if (obj.field == 'payMoney') {
                            var htMoney = $("#htMoney").val();
                            var bcxy = $("#bcxyMoney").val();
                            if(htMoney == "" || htMoney == null || htMoney == undefined){
                                layer.msg("请填写咨询合同金额！", {icon: 2});
                                return false;
                            }
                            var payMoney = Number(obj.data.payMoney);
                            var per = ((payMoney*100)/Number(htMoney)).toFixed(2);
                            if (per.indexOf("%") < 0) {
                                obj.update({
                                    sppPersent: per + "%"
                                });
                            }
                            table.reload("payways", {data: table.cache.payways});
                        }
                    },
                    toolbar: function (obj) {
                        var checkStatus = table.checkStatus(obj.config.id);
                        switch (obj.event) {
                            case 'addrow':
                                var tabledata = table.cache.payways;
                                var _aln = tabledata.length + 1;
                                tabledata.push({"sppId": "", "sppNo": _aln, "sppNode": "","nodeOrder": "","milepostName": "", "sppPersent": "", "payDate": "","payMoney":""});
                                table.reload("payways", {data: tabledata})
                                break;
                        }
                    }
                }
            },
            /*packages: {
                _init: function () {
                    $("#addpackage").click(_crt_page.packages.addMutilSQL);
                },
                getpackages: function () {
                    _gpakgs = [];
                    $("#FB").find(".sss").each(function (i, v) {
                        var _that = $(v);
                        //数组塞值  前端一个下拉框需要一个数组值
                        _gpakgs.push({name: _that.val(), value: _that.val()});
                    });
                }
            },*/
            stages: {
                _init: function () {

                    $("#zbjd").find('li').click(_crt_page.stages.loadStageMile.showmilepost);
                },
                getmilestoneselects: function () {
                    //根据阶段设置 拿去里程碑 进度占比
                    var _yopts = [];
                    var indexno=0
                    //加个判断防止一些不必要的错误
                    $("#dvmilepost").find("input[type=checkbox]").each(function (i, v) {
                        if( $(v).prop('checked')){
                            indexno++;
                            var mipostno=$(v).parent().next().attr("value");
                            _yopts.push('<option  layorder='+indexno+' value='+mipostno+'>' + $(v).attr('title') + '</option>');
                        }
                    })
                    return "<select id ='selmilepost' style='width:98%'>" + _yopts.join() + "</select>"
                },
                check: function () {
                    var start = document.getElementById("startDate").value;//获取起始日期
                    var end = document.getElementById("endDate").value;//获取结束日期
                    if (start == "") {
                        return;
                    } else if (end == "") {
                        return;
                    }
                    document.getElementById("totalDate").value = getDays(start, end);
                },
                getdays: function (startDate, endDate) {
                    var date1Str = startDate.split("-");//将日期字符串分隔为数组，数组元素分别为年、月、日
                    //根据年、月、日的值创建Date对象
                    var date1Obj = new Date(date1Str[0], (date1Str[1] - 1), date1Str[2]);
                    var date2Str = endDate.split("-");
                    var date2Obj = new Date(date2Str[0], (date2Str[1] - 1), date2Str[2]);
                    var t1 = date1Obj.getTime();//返回从1970-1-1开始计算到Date对象中的时间之间的毫秒数
                    var t2 = date2Obj.getTime();//返回从1970-1-1开始计算到Date对象中的时间之间的毫秒数
                    var datetime = 1000 * 60 * 60 * 24; //一天时间的毫秒值
                    var minusDays = Math.floor(((t2 - t1) / datetime));//计算出两个日期天数差
                    var days = Math.abs(minusDays);//如果结果为负数，取绝对值
                    return days;

                },
                loadStageMile: {
                    byProjectType: function (prjtype) {
                        layerAjaxGet('/zx/projectCreate/baseStage', {"projectTypeNo": prjtype}, '', function (d) {
                            var list = d.data;
                            if (d.flag == true) {
                                // 如果成功了 然后 就拼接阶段设置
                                if (d.data != null) {
                                    $("#zbjd").empty();
                                    $("#dvmilepost").find('ul').remove();
                                    var _lststgid = '';
                                    for (var i = 0; i < list.length; i++) {
                                        var _stg = list[i];
                                        var _stgid = _stg.id;
                                        var _mul = $("#dvmilepost").find("ul[pid=" + _stgid + "]");
                                        var _len = _mul.length;
                                        if (_len > 0) {
                                            var _mileLiEle = _crt_page.stages.loadStageMile.getmilepostLiElement(_stg);
                                            _mul.append(_mileLiEle);
                                        } else {
                                            var _stgliEle = _crt_page.stages.loadStageMile.getStageLiElement(_stg);
                                            _stgliEle.click(_crt_page.stages.loadStageMile.showmilepost);
                                            $("#zbjd").append(_stgliEle);
                                            var _mileul = $("<ul pid='" + _stgid + "' style='display: none'></ul>");
                                            var _mileLiEle = _crt_page.stages.loadStageMile.getmilepostLiElement(_stg);
                                            _mileul.append(_mileLiEle);
                                            $("#dvmilepost").append(_mileul);
                                        }
                                    }
                                    _crt_page.stages.loadStageMile._initStageDate();
                                    $("#zbjd").find('li:first').click();
                                    form.render('checkbox');
                                } else {
                                    layer.msg('返回数据为空', {icon: 2});
                                }
                            } else {
                                layer.msg(d.msg, {icon: 2});
                            }
                        });
                    },
                    _initStageDate: function () {
                        lay('#stagebox .stagerq').each(function () {
                            var  that=this;
                            laydate.render({
                                elem: this,
                                type: 'date',
                                trigger: 'click',
                                done: function (value, date) {
                                    var jd = $(this.elem[0]).attr('id');
                                    var  zgqStart=$("#totalDurationBeginDate").val();
                                    if(!zgqStart) {
                                        layer.msg("请选择总工期开始时间", {总工期icon: 2});
                                        $(that).val("");
                                        return;
                                    }
                                    var  zgqEnd=$("#totalDurationEndDate").val();
                                    if(!zgqEnd){
                                        layer.msg("请选择总工期结束时间", {总工期icon: 2});
                                        $(that).val("");
                                        return ;
                                    }
                                    if(jd=="zbBeginDate"){
                                        /*阶段开始时间*/
                                        if(value<zgqStart){
                                            layer.msg("阶段的开始时间不能早于总工期开始时间", {总工期icon: 2});
                                            $(that).val("");
                                            return ;
                                        }
                                        if(value>zgqEnd){
                                            layer.msg("阶段的开始时间不能晚于总工期结束时间", {总工期icon: 2});
                                            $(that).val("");
                                            return ;
                                        }
                                    }
                                    if(jd == "zbBeginDate"){
                                        var stateDate=$(that).parent().parent().prev().find("#zbEndDate").val();
                                        if(stateDate != null || stateDate != "" || stateDate != undefined){
                                            if(value < stateDate){
                                                layer.msg("阶段的开始时间时间不能上阶段的结束时间", {总工期icon: 2});
                                                $(that).val("");
                                                return ;
                                            }
                                        }
                                    }
                                    if(jd=="zbEndDate"){
                                        if(value<zgqStart){
                                            layer.msg("阶段的结束时间不能早于总工期开始时间", {总工期icon: 2});
                                            $(that).val("");
                                            return ;
                                        }
                                        if(value>zgqEnd){
                                            layer.msg("阶段的结束时间不能晚于总工期结束时间", {总工期icon: 2});
                                            $(that).val("");
                                            return ;
                                        }
                                        var jdbeginDate=$(that).parent().find("#zbBeginDate").val();
                                        if(value<jdbeginDate){
                                            layer.msg("阶段结束时间不能早于阶段开始时间", {总工期icon: 2});
                                            $(that).val("");
                                            return ;
                                        }
                                        if($(that).parents("li").eq(0).next().length>0  ){
                                            /*不是最后一个阶段*/
                                            var date1Str = value.split("-");//将日期字符串分隔为数组，数组元素分别为年、月、日
                                            //根据年、月、日的值创建Date对象
                                            var date1Obj = new Date(date1Str[0], (date1Str[1] - 1), date1Str[2]);
                                            date1Obj.setDate(date1Obj.getDate()+1);
                                            var year = date1Obj.getFullYear();
                                            var month = date1Obj.getMonth()+1;
                                            var date = date1Obj.getDate();
                                            if(month<10){
                                                month="0"+month;
                                            }
                                            if(date<10){
                                                date="0"+date;
                                            }
                                            var  datestrAdd = year+"-"+month+"-"+date;
                                            if(datestrAdd<zgqEnd  || datestrAdd==zgqEnd ){
                                                /*获取*/
                                                $(that).parents("li").eq(0).next().find("#zbBeginDate").val(datestrAdd)
                                            }
                                        }
                                    }
                                }
                            });
                        });
                        /*设置默认值*/
                        var  zgqStart=$("#totalDurationBeginDate").val();
                        if(zgqStart){
                            $("#zbjd").find("li").first().find("#zbBeginDate").val(zgqStart);
                        }
                        var  zgqEnd=$("#totalDurationEndDate").val();
                        if(zgqEnd){
                            $("#zbjd").find("li").last().find("#zbEndDate").val(zgqEnd);
                        }
                    },
                    getStageLiElement: function (stage) {
                        var _dsabled = false;
                        var _i = $("#zbjd").find('li').length;
                        return $('<li class="clearfix" stageId="' + stage.id + '">' +
                            '<input type="checkbox" lay-filter="stage" class="fl clearfix" value="' + stage.id + '" name=""  lay-skin="primary"   checked ' + _dsabled + '/>' +
                            '<span>' + stage.orderNum + '.' + stage.stageName + '<span style="color: red">*</span></span>'+
                            '<input type="hidden" class="zbstage" name="zxProjectStages[' + _i + '].id" value="' + stage.id + '">' +
                            '<input type="hidden" class="" name="zxProjectStages[' + _i + '].zbName" value="' + stage.stageName + '">' +
                            '<input type="hidden" class="" name="zxProjectStages[' + _i + '].stageNo" value="' + stage.stageNo + '">' +
                            '<input type="hidden" class="" name="zxProjectStages[' + _i + '].orderNum" value="' + stage.orderNum + '">' +
                            '<input type="hidden" class="open" name="zxProjectStages[' + _i + '].status" value="1">' +
                            '<div class="fr clearfix">' +
                            '<input type="text" class="fl stagerq" id="zbBeginDate" lay-verify="required" name="zxProjectStages[' + _i + '].startDate" >' +
                            '<span class="fl">--</span>' +
                            '<input type="text" class="fl stagerq" id="zbEndDate" lay-verify="required" name="zxProjectStages[' + _i + '].endDate" >' +
                            '</div>' +
                            '</li>');
                    },
                    getmilepostLiElement: function (stage) {
                        var _dsabled = false;
                        var _i = $("#dvmilepost").find("li").length;
                        return $('<li class="clearfix">' +
                            '<span class="fl">' +
                            '<input type="checkbox" name="lcb"  lay-skin="primary" checked ' + _dsabled + ' mname="' + stage.milepostName+'"  title="' + stage.milepostOrderNum + '.' + stage.milepostName + '"/>' +
                            '<input type="hidden" class="open" name="zxProjectMileposts[' + _i + '].status" value="1">' +
                            '</span>' +
                            '<input type="hidden" class="jdmilepostno" name="zxProjectMileposts[' + _i + '].milepostNo" value="' + stage.milepostCode + '">' +
                            '<input type="hidden" class="jdpercentage" name="zxProjectMileposts[' + _i + '].supervisorProjectStageId" value="' + stage.id + '">' +
                            '<input type="hidden" class="jdpercentage" name="zxProjectMileposts[' + _i + '].spmBaseMilePostId" value="' + stage.milepostId + '">' +
                            '<div class="fr">' +
                            '<input type="text" class="jdpercentage" name="zxProjectMileposts[' + _i + '].percentage" value="' + stage.milepostZb + '" style="width:80px;text-align: right"/>%' +
                            '</div>' +
                            '</li>');
                    },
                    showmilepost: function () {
                        var that = $(this);
                        var _stgid = that.attr('stageId');
                        that.parent().find('li').removeClass('selected');
                        that.addClass('selected')
                        $("#dvmilepost").find('ul').hide();
                        $("#dvmilepost").find("ul[pid=" + _stgid + "]").show();
                        _crt_page.events.displayMilepost();
                    }
                }
            },
            fzr: {
                _init: function () {
                    $('#btn_addfzr').click(_crt_page.fzr.addFuzeren);
                },
                addFuzeren: function () {
                    // 负责人下面有个分包  上面的分包写多少 就在这个下拉框的地方显示几个
                    var _len = $("#FZR .enterpriseUnitList").length;
                    $("#FZR").find(".center").before('<div class="enterpriseUnitList mbox"><div class="bold ft18">项目负责人<span class="unit-ind">' + ($("#FZR").find('.enterpriseUnitList:visible').length + 1) + '</span><img src="${re.contextPath}/plugin/common/images/31@2x.png" onclick="_crt_page.fzr.del(this)"  alt="" class="fr cursor" style="width:13px"></div><ul class="clearfix mt20"><li class="clearfix"><label class="fl w120">项目负责人<span style="color: red">*</span></label><input type="text" class="fzr unit-ind-1" name="projectLeaders[' + (_len) + '].realName" lay-maxlength="128" lay-verify="required|maxlength"></li><li class="clearfix"><label class="fl">职务<span style="color: red">*</span></label><input type="text" class="zw unit-ind-1" name="projectLeaders[' + (_len) + '].duty" lay-maxlength="128" lay-verify="required|maxlength"></li></ul></div> ');
                   // _crt_page.forms.selects._intSlt(_len, 'slt');
                },
                del: function (object) {
                    var _len = $("#FZR .enterpriseUnitList").length;
                    var x = 0;
                    lay('#FZR .enterpriseUnitList').each(function (ind,obj) {
                        if($(obj).css('display') == 'none'){
                            x++
                        }
                    })
                    _len = _len - x;
                    if(_len == 1){
                        layer.msg("不能全部删除", {icon: 2});
                        return;
                    }
                    var _b = $(object).attr("idx");
                    if (_b) {
                        var _a = $("<input type=\"hidden\" value=\"-1\"  name=\"projectLeaders[" + _b + "].createBy\">");
                        $(object).parent().parent().append(_a);
                        $(object).parent().parent().hide();
                    } else {
                        $(object).parent().parent().remove();
                    }
                    _crt_page.fzr.formatFzrInd();
                },
                formatFzrInd: function () {
                    var showInd = 1;
                    lay('#FZR .enterpriseUnitList').each(function (ind,obj) {
                        if($(obj).css('display') != 'none'){
                            $(obj).find('.unit-ind').text(showInd);
                            $(obj).find('.slt').attr("id",showInd);
                            showInd ++;
                        }else{
                            $(obj).find('.slt').removeAttr('id');
                        }
                    });
                }
            },
            events: {
                _init: function () {
                    $("#province").change(_crt_page.events.province);
                    $("#city").change(_crt_page.events.city);
                    $("#projectType").change(_crt_page.events.projecttype);
                },
                toDate: function (object) {
                    var code = $(object).val();
                    if (code == "1") {
                        _crt_page.tables.renderTable(false,true);
                    } else {
                        _crt_page.tables.renderTable(true,false);
                    }
                    /*初始化付款金额*/
                    var htMoney = $("#htMoney").val();
                    if (htMoney) {
                        var tabledata = table.cache.payways;
                        for (var j = 0; j < tabledata.length; j++) {
                            var sppPersent = tabledata[j].sppPersent;
                            if (sppPersent) {
                                var payM = (htMoney * ((parseFloat(sppPersent.replace("%", ""))) / 100)).toFixed(2);
                                tabledata[j].payMoney = payM;
                            }
                        }
                    }
                    table.reload("payways", {data: tabledata});
                    //监听行工具事件
                    /*table.on('tool(payways)', function (obj) {
                        var data = obj.data;
                        if(obj.event === 'editStartDate'){
                            var field = $(this).data('field');
                            laydate.render({
                                elem: this.firstChild
                                , show: true //直接显示
                                , closeStop: this
                                , done: function (value, date) {
                                    data[field] = value;
                                    obj.update(data);
                                }
                            });
                        }
                    });*/
                },
                toHetong: function (object) {
                    var code = $(object).val();
                    if(code == "0"){
                        $("#hetongDiv").css("display","none");
                    }else{
                        $("#hetongDiv").css('display', 'block');
                    }
                },
                toDate2: function (object) {
                    var code = $(object).val();
                    var date = $("#totalDurationBeginDate").val();
                    if(date == null || date == "" || date == undefined){
                        return;
                    }
                    var re = /^[0-9]*[1-9][0-9]*$/ ;
                    if(!(re.test(code))){
                        layer.msg("请输入正整数", {icon: 2});
                        $(object).val("");
                        return;
                    }
                    var day = DateDiff2(date,code);
                    $("#totalDurationEndDate").val(day);
                    $("#zbjd").find("li").last().find("#zbEndDate").val(day)
                    $("#zbjd").find("li").first().find("#zbBeginDate").val(date)
                },
                toZhaoBiao: function (object) {
                    var code = $(object).val();
                    if(code == "0"){
                        $("#zhaobiaoDiv").css("display","none");
                    }else{
                        $("#zhaobiaoDiv").css('display', 'block');
                    }
                },
                showKzByRole:function(){
                    if(("${xmjl}" == "1" && "${prj.status}" == "001")){
                        $("input").removeAttr("disabled");
                    }
                    if(("${hyfzr}"== "true")|| "${prj.status}" == "003" || ("${xmjl}" == "1" && "${prj.status}" != "001")){
                        /*总监理工程师 只能修改阶段时长 和总工期  投資額 和 监理合同额*/
                        //下来列表只读
                        $("select").attr("disabled", true);
                        //输入框只读
                        $("input").attr("readonly",true);
                        $('#stagebox .stagerq').attr("disabled", true);
                        if((("${xmjl}" == "1" && "${prj.status}" != "001") || ("${hyfzr}" == "true" && "${prj.status}" != "001") || "${prj.status}" != "003")){
                            $("#bcxyMoney").removeAttr("readonly");
                            $(".stage input").attr("readonly",false);
                            $("#totalDate").removeAttr("readonly");
                            $('#stagebox .stagerq').attr("disabled", false);
                            $('#stagebox .stagerq').attr("readonly", true);
                            $("#contractNo").removeAttr("readonly");
                            $("#payOrProjectNo").removeAttr("readonly");
                            $("#jlHtName").removeAttr("readonly");
                            $("select[name^='projectPlacedtos']").attr("disabled", false);
                            $("#insideContractNo").removeAttr("readonly");
                            $("#hasInviteBids").attr("disabled",false);
                            $("#hasContractSigned").attr("disabled",false);
                            $("#hasDownPayment").attr("disabled",false);
                            $("#projectType").attr("disabled",false);
                            $("#htMoney").removeAttr("readonly");
                            if("${hyfzr}" == "true" && "${prj.status}" != "001"){
                                $("#tzMoney").removeAttr("readonly");
                                $("#htMoney").removeAttr("readonly");
                                $("#hyType").attr("disabled",false);
                                $("#contractAmount").attr("disabled",false);
                            }
                        }
                    }
                },
                provinceChange: function (object) {
                    var code = $(object).find('option:selected').val();
                    if (code == "") {
                        return;
                    }
                    layerAjaxGet('/sys/register/getOrganize', {"code": code}, '', function (d) {
                        if (d.flag == true) {
                            $(object).next().empty().append("<option value=''>选择市</option>");
                            for (var i = 0; i < d.data.length; i++) {
                                $(object).next().append("<option value='" + d.data[i].code + "'>" + d.data[i].name + "</option>");
                            }
                        } else {
                            layer.msg(d.msg, {icon: 2});
                        }
                    });
                },
                addPlace: function (object) {
                    $(object).parent().after(" <div class=\"clearfix mt10 divplaceselect\">\n" +
                        "                            <select name=\"projectPlacedtos[1].province\" class=\"ml8 fl\" id=\"placeprovince1\"   onchange=\"_crt_page.events.provinceChange(this)\"  style=\"width:90px !important;\"\n" +
                        "                                    lay-verify=\"required\" lay-ignore>\n" +
                        "                                <option value=\"\">请选择</option>\n" +
                        "                                <#list provincelist as vo>\n" +
                        "                                    <option value=\"${vo.code}\">${vo.name}</option>\n" +
                        "                                </#list>\n" +
                        "                            </select>\n" +
                        "                            <select name=\"projectPlacedtos[1].city\" id=\"placecity1\" class=\"ml8 fl\"  onchange=\"_crt_page.events.cityChange(this)\" lay-filter=\"projectPlacedtos[1].city\" lay-verify=\"required\"\n" +
                        "                                    style=\"width: 90px !important;margin-left: 10px\" lay-ignore>\n" +
                        "                                <option value=\"\">请选择</option>\n" +
                        "                            </select>\n" +
                        "                            <select name=\"projectPlacedtos[1].county\" id=\"placecounty1\" class=\"ml8 fl\" lay-filter=\"projectPlacedtos[1].county\" lay-verify=\"required\"\n" +
                        "                                    style=\"width:90px !important;margin-left: 10px\" lay-ignore>\n" +
                        "                                <option value=\"\">请选择</option>\n" +
                        "                            </select>\n" +
                        "                            <img src=\"${re.contextPath}/plugin/common/images/77@2x.png\" class=\"fl ml20 addplaceimage\" style=\"width: 28px;\" onclick=\"_crt_page.events.addPlace(this)\" >\n" +
                        "                            <img src=\"${re.contextPath}/plugin/common/images/76@2x.png\" class=\"fl ml20\"  style=\"width: 28px;\" onclick=\"_crt_page.events.deletePlace(this)\">\n" +
                        "                        </div>");
                    _crt_page.events.resetPlace();

                },
                resetPlace: function () {
                    /*  $(".ssplace").find(".addplaceimage:not(:last)").attr("style","display:none;")*/
                    $(".ssplace").find(".divplaceselect").each(function (i, v) {
                        $(v).find("select:eq(0)").attr("name", "projectPlacedtos[" + i + "].province")
                        $(v).find("select:eq(1)").attr("name", "projectPlacedtos[" + i + "].city");
                        $(v).find("select:eq(2)").attr("name", "projectPlacedtos[" + i + "].county");
                        $(v).find("select:eq(0)").attr("lay-filter", "projectPlacedtos[" + i + "].province");
                        $(v).find("select:eq(1)").attr("lay-filter", "projectPlacedtos[" + i + "].city");
                        $(v).find("select:eq(2)").attr("lay-filter", "projectPlacedtos[" + i + "].county");
                    });
                },
                deletePlace: function (object) {
                    var placeLength = $(".ssplace").find(".divplaceselect").length;
                    if (placeLength == 1) {
                        layer.msg("合同签订地点不能全部删除", {icon: 2});
                    } else {
                        $(object).parent().remove();
                        _crt_page.events.resetPlace();
                    }

                },
                cityChange: function (object) {
                    var code = $(object).find('option:selected').val();
                    if (code == "") {
                        return;
                    }
                    layerAjaxGet('/sys/register/getOrganize', {"code": code}, '', function (d) {
                        if (d.flag == true) {
                            $(object).next().empty().append("<option value=''>选择区县</option>");
                            for (var i = 0; i < d.data.length; i++) {
                                $(object).next().append("<option value='" + d.data[i].code + "'>" + d.data[i].name + "</option>");
                            }
                        } else {
                            layer.msg(d.msg, {icon: 2});
                        }
                    });

                },

                province: function () {
                    var code = $('#province option:selected').val();
                    if (code == "") {
                        return;
                    }
                    layerAjaxGet('/sys/register/getOrganize', {"code": code}, '', function (d) {
                        if (d.flag == true) {
                            $("#city").empty().append("<option value=''>选择市</option>");
                            for (var i = 0; i < d.data.length; i++) {
                                $("#city").append("<option value='" + d.data[i].code + "'>" + d.data[i].name + "</option>");
                            }
                        } else {
                            layer.msg(d.msg, {icon: 2});
                        }
                    });
                },
                city: function () {
                    var code = $('#city option:selected').val();
                    if (code == "") {
                        return;
                    }
                    layerAjaxGet('/sys/register/getOrganize', {"code": code}, '', function (d) {
                        if (d.flag == true) {
                            $("#county").empty().append("<option value=''>选择区县</option>");
                            for (var i = 0; i < d.data.length; i++) {
                                $("#county").append("<option value='" + d.data[i].code + "'>" + d.data[i].name + "</option>");
                            }
                        } else {
                            layer.msg(d.msg, {icon: 2});
                        }
                    });
                },
                projecttype: function () {
                    var projectTypeNo = $("#projectType option:selected").val();
                    _crt_page.stages.loadStageMile.byProjectType(projectTypeNo);
                },
                displayMilepost: function () {
                    var htMoney = $("#htMoney").val();
                    var bcxy = $("#bcxyMoney").val();
                    if(htMoney == "" || htMoney == null || htMoney == undefined){
                        return false;
                    }
                    if(bcxy == "" || bcxy == null || bcxy == undefined){
                        bcxy = 0;
                    }
                    var money = htMoney;
                    if(bcxy != null && bcxy != "" && bcxy != undefined){
                        money = Number(htMoney) + Number(bcxy);
                    }
                    var oldData = table.cache.payways;
                    $.each(oldData, function (ind, item) {
                        var payMoney = Number(item.payMoney);
                        var per = ((payMoney*100)/money).toFixed(2);
                        if (per.indexOf("%") < 0) {
                            oldData[ind].sppPersent = per + "%";

                        }
                    })
                    table.reload("payways", {data: oldData});
                    //动态设置'监理实施细则'里程的显示:
                    var stages = $("#zbjd").find('li');
                    var i = stages.length;
                    if (i > 0) {
                        var stageO = 0;
                        _crt_page.events.handleStage(stages, 0, i);
                    }
                }, handleStage:function(stages, i, end) {
                    var aLi = stages[i];
                    var stageId = $(aLi).find('.zbstage').val();
                    var milepostCodes = $("#dvmilepost").find(".jdmilepostno");
                    if (milepostCodes.length > 0) {
                        _crt_page.events.handleMilepost(aLi, milepostCodes, 0, milepostCodes.length);
                    }
                    i++;
                    if (i < end) {
                        _crt_page.events.handleStage(stages, i, end);
                    }
                }, handleMilepost:function(aLi, milepostCodes, i, end) {
                    <#--if (($(milepostCodes[i]).val() == '${jlssxzMilepost}') || ($(milepostCodes[i]).val() == '${jlssxzMilepost2}')) {-->
                    <#--    if ($('#htMoney').val() * 1 > '${supervisorContractQuota}' * 1) {-->
                    <#--        $(milepostCodes[i]).parent().find('input').removeAttr('disabled');-->
                    <#--        $(milepostCodes[i]).prev().find('input').attr('disabled', 'disabled');-->
                    <#--        if ($(aLi).hasClass("selected")) {-->
                    <#--            $(milepostCodes[i]).parent().show();-->
                    <#--        }-->
                    <#--        $.each($(milepostCodes[i]).parent().find('input'), function (e) {-->
                    <#--            var oldname = $(this).attr('oldname');-->
                    <#--            $(this).attr('name', oldname);-->
                    <#--            $(this).removeAttr('oldname');-->
                    <#--        })-->
                    <#--    } else {-->
                    <#--        $(milepostCodes[i]).parent().find('input').attr('disabled', 'disabled');-->
                    <#--        if ($(aLi).hasClass("selected")) {-->
                    <#--            $(milepostCodes[i]).parent().hide();-->
                    <#--        }-->
                    <#--        $.each($(milepostCodes[i]).parent().find('input'), function (e) {-->
                    <#--            var name = $(this).attr('name');-->
                    <#--            $(this).attr('oldname', name);-->
                    <#--            $(this).removeAttr('name');-->
                    <#--        })-->
                    <#--    }-->
                    <#--}-->
                    i++;
                    if (i < end) {
                        _crt_page.events.handleMilepost(aLi, milepostCodes, i, end);
                    }
                }
            }
        }
        _crt_page._init();
        _crt_page.events.showKzByRole();
    });
    function resetRequired(){
        form.verify({
            required: function(v){

            }
        })
    }
    function resetRequiredSubmit(){
        form.verify({
            required: function(v){
                if(v == ""){
                    return "必填项不能为空";
                }
            }
        })
    }
    function tzym(){
        var id = "${prj.id}";
        window.parent._delTabT('31760d1559354c20b66bf349382ae03a');
        window.parent._showtab('31760d1559354c20b66bf349382ae03a', '管理项目', '/zx/projectManager/projectIndex');
        window.parent._delTabT('xm_i'+id);
    }
</script>
</body>
</html>
